"""
华为机试和视频面试算法题
"""

class Solution1:
    """视频面试1"""

    def transpose(self, li):
        m = len(li)
        n = len(li[0])

        b = []
        for i in range(n):
            c = []
            for j in range(m):
                c.append(li[j][i])
            b.append(c)

        return b


class Solution2:
    """视频面试2"""

    def min_cost(self, li):
        li.insert(0, 0)
        return self.digui(li)

    def digui(self, li):
        """视频面试2"""

        if len(li) <= 2:
            return li[0]
        return li[0] + min(self.digui(li[1:]), self.digui(li[2:]))


if __name__ == '__main__':
    print('-'*10 + '第1题' + '-'*10)
    li1 = [[6, 9, 18, 77], [7, 33, 34, 89], [8, 90, 93, 2000]]
    li1 = [[1,2,3],[4,5,6]]
    so = Solution1()
    b = so.transpose(li1)
    print(b)

    print('-'*10 + '第2题' + '-'*10)
    li1 = [0, 1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
    so = Solution2()
    cost = so.min_cost(li1)
    print(cost)
